<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="../css/reset.css"/>
    <link rel="stylesheet" type="text/css" href="../css/chengshi.css">
</head>
<body>
    
    <header class="header">
        <div class="left">
            <img src="../imgs/fanhui.png"/>
            <p>返回</p>
        </div>
        <div class="center">城市</div>
        <div class="right"></div>
    </header>

    <section class="sec">
        
    </section>
    

    
    <script src="../js/flexible.debug.js"></script>
    <script src="../js/flexible_css.debug.js"></script>
    <script src="../js/jquery-1.12.4.min.js"></script>
    <script src="../js/artTemplate.js"></script>
    
    
    <script type="text/html" id="list">
        
        {{each list as v}}
            <div class="dd">
                <h4 class="sheng">
                    <span>{{v.name}}</span>
                </h4>
                <ul class="shi">
                    {{each v.child as j}}
                        <li>{{j.name}}</li>
                    {{/each}}
                </ul>
            </div>
        {{/each}}
        
    </script>
        
    <script>
        jQuery(function($){
            function lis(star, end){
                $.ajax({
                    type: "get",
                    dataType: "json",
                    url: "../json/chengshi.json",
                    success: function(data){
                        //console.log(data);
//                        data = data.slice(star, end);
                        var str = template("list", {list: data});
                        $(".sec").append(str);
                    }
                })
            }
            
            var aa = 0, bb = 5;
            
            lis(aa, bb);
            
//            $(".btn").on("click", function(){
//                aa += 5;
//                bb += 5;
//                lis(aa, bb);
//            });
            
            $(".sec").on("click", "h4", function(){
                $(this).toggleClass("da");
                $(this).next().slideToggle();
            }) 
        })
    </script>
    
    
    <script>
        $(".left").on("click", function(){
            location.href = "already logged in.html";
        })
    </script>
    
    
</body>
</html>